package collect;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 泛型类
 * @author galen
 */
public class BookCategoryDao {
    /**
     * 定义泛型Map，存储图书信息
     */
    public static Map<BookCategory, List<BookInfo>> categoryMap = new HashMap<BookCategory, List<BookInfo>>();
    
    public static void printDeptmentInfo() {
        for (BookCategory cate : categoryMap.keySet()) {
            System.out.println("所属类别：" + cate.getName());
            List<BookInfo> books = (List<BookInfo>) categoryMap.get(cate);
            System.out.println("图书编号\t\t图书名称\t\t图书价格\t\t图书作者\t\t出版时间");
            for (int i = 0; i < books.size(); i++) {
                BookInfo b = books.get(i);
                System.out.println(b.getId()+"\t\t"+b.getName()+"\t\t"+b.getPrice()+"\t\t"+b.getAuthor()+"\t\t"+b.getStartTime());
            }
            System.out.println();
        }
    }
}
